Skip to content

feat(security-contacts): implement tier D#4373

Merged
mbani01 merged 6 commits into
mainfrom
feat/security_contacts_tier_d
Jul 22, 2026
Merged

feat(security-contacts): implement tier D#4373
mbani01 merged 6 commits into
mainfrom
feat/security_contacts_tier_d

Conversation

@mbani01

@mbani01 mbani01 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This pull request adds new fallback mechanisms for extracting security contacts from GitHub repositories, specifically targeting cases where no higher-tier, reachable contacts are found. It introduces two new extractors: one for identifying top committers and another for finding the repository owner, both of which supplement the existing contact extraction pipeline. Additionally, the pull request adds support for extracting Go ecosystem registry contacts.

New fallback contact extraction:

  • Added fetchTopCommitters extractor to identify the top human committers (by email and GitHub handle) from the past 90 days of repository history, excluding bots, and return them as security contacts.
  • Added fetchRepoOwner extractor to extract the repository owner's GitHub handle and, if available, their public email as security contacts.
  • Updated processRepo in processBatch.ts to invoke these new extractors only when no higher-tier, reachable contacts are found, ensuring more robust fallback contact coverage.

Go ecosystem support:

  • Added a new fetchGo extractor for the Go package registry, returning the Go security team's contact email and web form as default contacts.
  • Registered the Go extractor in the registry fetchers, enabling Go ecosystem support in the contact extraction pipeline. [1] [2] [3]

mbani01 added 2 commits July 21, 2026 11:18
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
@mbani01 mbani01 self-assigned this Jul 21, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 13:54
@cursor

cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Adds GitHub API load and may surface committer/owner emails as tier-D contacts when higher-tier sources fail, but fallbacks are gated and contacts remain low-confidence tier D.

Overview
Adds tier D security-contact sources when a repo still has no usable contact above tier D (non-junk, reachable email where applicable).

GitHub fallbacks run in parallel only in that case: top committers from the last 90 days (bots filtered, contributor stats polled on HTTP 202) plus repo owner handle and optional public profile email. githubApiGet gains extraOkStatuses so async stats endpoints can return without throwing.

Go packages get static registry contacts (security@golang.org, Go vulnz web form) via a new fetchGo manifest fetcher registered for the go ecosystem.

Pipeline wiring: processRepo applies the fallback gate before CDP email resolution; isJunkContact is exported for reuse with reachability checks in the gate.

Reviewed by Cursor Bugbot for commit 729f6a5. Bugbot is set up for automated code reviews on this repo. Configure here.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Tier D fallback security-contact extraction for GitHub repositories and Go packages.

Changes:

  • Adds top-committer and repository-owner fallbacks.
  • Activates fallbacks when higher-tier contacts are unavailable.
  • Registers Go ecosystem contacts.

Metadata: PR title lacks the required (CM-XXX) suffix.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
processBatch.ts Integrates Tier D fallbacks.
topCommitters.ts Extracts recent committers.
repoOwner.ts Extracts repository-owner contacts.
registry/index.ts Registers Go extraction.
registry/go.ts Defines Go security contacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/apps/packages_worker/src/security-contacts/processBatch.ts Outdated
Comment thread services/apps/packages_worker/src/security-contacts/extractors/topCommitters.ts Outdated
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Copilot AI review requested due to automatic review settings July 21, 2026 14:19
Comment thread services/apps/packages_worker/src/security-contacts/extractors/topCommitters.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

const path = `/repos/${owner}/${name}/stats/contributors`
let stats: ContributorStat[]
try {
const { text } = await deps.githubGet(path)
Copilot AI review requested due to automatic review settings July 21, 2026 14:41

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f6a517d. Configure here.

if (isJunkContact(c)) return false
return c.channel !== 'email' || classifyEmailReachability(c.value).reachable
}
const hasUsableHigherTierContact = contacts.some((c) => c.tier !== 'D' && isUsableRaw(c))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PVR guess blocks tier D

Medium Severity

The tier D gate treats tier B github-pvr contacts from SECURITY.md keyword inference as usable higher-tier contacts whenever isUsableRaw passes, even when pvrEnabled was never set to true. That skips fetchTopCommitters and fetchRepoOwner while only a speculative PVR URL remains—after the existing veto that drops github-pvr when PVR is explicitly disabled.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f6a517d. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment on lines +53 to +56
const count = (stat.weeks ?? []).reduce((sum, week) => {
const w = typeof week.w === 'number' ? week.w : 0
const c = typeof week.c === 'number' ? week.c : 0
return w >= sinceUnixSeconds ? sum + c : sum
Comment on lines +35 to +39
function isBotLogin(login: string): boolean {
const lower = login.toLowerCase()
if (lower.endsWith('[bot]')) return true
return BOT_TOKENS.some((token) => lower.includes(token))
}
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Copilot AI review requested due to automatic review settings July 21, 2026 15:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

services/apps/packages_worker/src/security-contacts/processBatch.ts:181

  • The fallback gate still runs before CDP handle resolution and final reconciliation. A higher-tier GitHub handle can count as usable here, then resolveCdpEmails can link it to a disposable or non-GitHub noreply address; identityLinkMerge removes the handle in favor of that email, which is finally marked unreachable. Tier D is then skipped even though the reconciled result has no reachable higher-tier contact. Resolve/reconcile the higher-tier candidates before evaluating this gate, and resolve any newly added Tier D handles afterward.
  const hasUsableHigherTierContact = contacts.some((c) => c.tier !== 'D' && isUsableRaw(c))

services/apps/packages_worker/src/security-contacts/extractors/topCommitters.ts:46

  • Substring matching classifies legitimate humans as bots: usernames such as claude, claudette, or any login containing openai are discarded, and the same helper also rejects public emails containing those strings. GitHub already supplies author.type; keep any fallback detection to precise bot-login patterns rather than generic brand-name substrings.
function matchesBotToken(value: string): boolean {
  const lower = value.toLowerCase()
  return BOT_TOKENS.some((token) => lower.includes(token))

Comment on lines +191 to +192
const path = `/repos/${owner}/${name}/stats/contributors`
const stats = await fetchContributorStats(path, target, owner, name, deps.githubGet, sleep)
@mbani01
mbani01 merged commit b7a606e into main Jul 22, 2026
15 checks passed
@mbani01
mbani01 deleted the feat/security_contacts_tier_d branch July 22, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants